#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 3005;

int n, m;
struct Node {
  ll x, c;
  bool operator<(const Node& o) const { return x < o.x; }
} a[N];
ll sum[N];
ll y[N], x[N];
ll q[N], head = 1, tail = 0;
ll dp[N];
double slope(int i, int j) { return double(y[i] - y[j]) / (x[i] - x[j]); }
ll f(int i) { return dp[i] - sum[i] + (1 + i) * a[i].x; }
void solve() {
  cin >> n;
  rep(i, 1, n) cin >> a[i].x >> a[i].c;
  sort(a + 1, a + n + 1);
  per(i, n, 1) a[i].x -= a[1].x;
  a[n + 1] = {a[n].x + 1, 0};
  ++n;
  rep(i, 1, n) sum[i] = sum[i - 1] + a[i].x;
  dp[1] = a[1].c, y[1] = f(1), x[1] = a[1].x;
  rep(i, 2, n) {
    while (head < tail && slope(q[tail - 1], q[tail]) >= slope(q[tail], i - 1))
      --tail;
    q[++tail] = i - 1;
    while (head < tail && slope(q[head], q[head + 1]) <= i) ++head;
    int j = q[head];
    dp[i] = y[j] - i * x[j] + a[i].c + sum[i - 1];
    y[i] = f(i), x[i] = a[i].x;
  }
  cout << dp[n] << endl;
  return;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}